package cn.csc.module.shop.dal.mysql.slideimg;

import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.shop.dal.dataobject.slideimg.ShopSlideImgDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csc.module.shop.controller.admin.slideimg.vo.*;

/**
 * 轮播图 Mapper
 *
 * @author liuchuang
 */
@Mapper
public interface ShopSlideImgMapper extends BaseMapperX<ShopSlideImgDO> {

    default PageResult<ShopSlideImgDO> selectPage(ShopSlideImgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopSlideImgDO>()
                .eqIfPresent(ShopSlideImgDO::getShopId, reqVO.getShopId())
                .eqIfPresent(ShopSlideImgDO::getSpuId, reqVO.getSpuId())
                .eqIfPresent(ShopSlideImgDO::getImgType, reqVO.getImgType())
                .orderByDesc(ShopSlideImgDO::getId));
    }

    default List<ShopSlideImgDO> selectList(ShopSlideImgExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopSlideImgDO>()
                .eqIfPresent(ShopSlideImgDO::getShopId, reqVO.getShopId())
                .eqIfPresent(ShopSlideImgDO::getImgUrl, reqVO.getImgUrl())
                .eqIfPresent(ShopSlideImgDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ShopSlideImgDO::getSeq, reqVO.getSeq())
                .eqIfPresent(ShopSlideImgDO::getSpuId, reqVO.getSpuId())
                .eqIfPresent(ShopSlideImgDO::getImgType, reqVO.getImgType())
                .betweenIfPresent(ShopSlideImgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopSlideImgDO::getId));
    }

}
